package com.ender.springboot.mq;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class RabbitSender {
    @Autowired
    private RabbitTemplate rabbitTemplate;

    public void sendHello(String message) {
        System.out.println("hello Sender:" + message);
        rabbitTemplate.convertAndSend("hello", message);
    }
    public void pushMovie(String message) {
        System.out.println("pushMovie Sender:" + message);
        rabbitTemplate.convertAndSend("push.pushmovie",message);
    }
    public void pushAll(String message) {
        System.out.println("pushAll Sender:" + message);
        rabbitTemplate.convertAndSend("topicExchange","push.#", message);
    }

    public void fanout(String message){
        System.out.println("fanout Sender:"+message);
        rabbitTemplate.convertAndSend("fanoutExchange","",message);
    }

}